﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace Project
{
    public static class CommonMethod
    {
        public static int row = 10;
        public static int column = 10;
        public static List<Point> Return9Grid(Landmine grid)
        {
            Point pt = grid.Position;

            List<Point> numberLst = new List<Point>();

            if (pt.X - 1 >= 0 && pt.Y - 1 >= 0)
            {
                numberLst.Add(new Point(pt.X - 1, pt.Y - 1));
            }
            if (pt.Y - 1 >= 0)
            {
                numberLst.Add(new Point(pt.X, pt.Y - 1));
            }
            if (pt.X + 1 <= column && pt.Y - 1 >= 0)
            {
                numberLst.Add(new Point(pt.X + 1, pt.Y - 1));
            }

            if (pt.X - 1 >= 0)
            {
                numberLst.Add(new Point(pt.X - 1, pt.Y));
            }
            if (pt.X + 1 <= column)
            {
                numberLst.Add(new Point(pt.X + 1, pt.Y));
            }

            if (pt.X - 1 >= 0 && pt.Y + 1 <= row)
            {
                numberLst.Add(new Point(pt.X - 1, pt.Y + 1));
            }
            if (pt.Y + 1 <= row)
            {
                numberLst.Add(new Point(pt.X, pt.Y + 1));
            }
            if (pt.X + 1 <= column && pt.Y + 1 <= row)
            {
                numberLst.Add(new Point(pt.X + 1, pt.Y + 1));
            }

            return numberLst;
        }
    }
}
